# 输出二维数组
def show2d(b):
    for i in range(len(b)):
        for j in range(len(b[i])):
            print(b[i][j], end=" ")
        print()
    print()


# 创建一个二维数组 行数row,列数为col
def create2d(row, col):
    b = []
    for i in range(row):
        b.append(list([0] * col))
    return b



def main():
    while True:
        n = int(input())
        if n == 0:
            break
        b = create2d(n, n)
        x, y = n - 1, n // 2
        b[x][y] = 1
        for k in range(2, n * n + 1):
            nx, ny = (x + 1) % n, (y + 1) % n
            if b[nx][ny] != 0:
                nx, ny = (x - 1 + n) % n, y
            b[nx][ny] = k
            x, y = nx, ny

        show2d(b)


main()
